﻿Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports System.IO
Imports EyeOpen
Imports EyeOpen.IO

Namespace EyeOpen.IO.Test

	<TestClass>
	Public MustInherit Class DirectorySearchTest
		Private ReadOnly logger As ILogger = New TestLogger()

		Private ReadOnly directoryInfo As IDirectoryInfo

		Protected Sub New()
			directoryInfo = GetDirectoryInfo()
		End Sub

		<TestMethod>
		Public Sub SearchFileThatExist()
			Dim file = New DirectorySearch().Search(directoryInfo, DirectoryKnownValues.FileName, logger)

			Dim expectedPath = Path.Combine(directoryInfo.FullName, DirectoryKnownValues.Folder, DirectoryKnownValues.FileName)

			Assert.AreEqual(file.FullName, expectedPath)
		End Sub

		<TestMethod>
		Public Sub SearchFileThatNotExist()
			Dim file = New DirectorySearch().Search(directoryInfo, "notexists.txt", logger)

			Assert.IsNull(file)
		End Sub

		Protected MustOverride Function GetDirectoryInfo() As IDirectoryInfo
	End Class
End Namespace